package main

import (
	"errors"
	"fmt"
	"github.com/spf13/cast"
	"time"
)

type User struct {
	id   int
	name string
}

func main() {
	//time := time.Now()
	//fmt.Println(time)
	const layout = "2006-01-02T15:04:05Z07:00" // 注意：这里的数字是占位符，表示真实的年、月、日等
	dateStr := "2021-12-07T15:00:00Z"
	t, err := time.Parse(layout, dateStr)
	if err != nil {
		fmt.Println("Error parsing time:", err)
		return
	}
	fmt.Println("Parsed time:", t)
	//d := time.Date(2021, 12, 7, 15, 0, 0, 0, time.UTC)
	formattedTime := t.Format("2006-01-02 15:04:05") // 注意：这里的数字是占位符，表示真实的年、月、日等
	fmt.Println("Formatted time:", formattedTime)

	a1 := cast.ToUint64(t.Unix())
	fmt.Println(a1)

	// err
	err = errors.New("test error")
	fmt.Println(err)

	err = fmt.Errorf("%d", 12)
	fmt.Println(err)
}
